package com.bayihouse.model.vo;

import com.bayihouse.model.excel.publicClass.father.BaseEntity;
import jnr.ffi.annotations.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

@AllArgsConstructor
@Data
@NoArgsConstructor
public class BaseEntityVO implements Serializable {


    private static final long serialVersionUID = -2945210465891651579L;

    private Long id;

    private Integer rank;


    private String name;

    public static List<BaseEntityVO> objToVOList(List<BaseEntity> objectList, Integer rank) {
        if (objectList != null) {
            return objectList.stream().map(object -> new BaseEntityVO(object.getId(), rank, object.getName())).collect(Collectors.toList());
        }
        return null;
    }
}
